import request from '@/api/request'

export const getCustomers = (params) => request.get('/customer/list', { params })
export const getCustomer = (id) => request.get(`/customer/${id}`)
export const addCustomer = (data) => request.post('/customer', data)
export const updateCustomer = (data) => request.put('/customer', data)
export const deleteCustomer = (id) => request.delete(`/customer/${id}`)
export const importCustomers = (file) => {
  const formData = new FormData()
  formData.append('file', file)
  return request.post('/customer/import', formData, { headers: { 'Content-Type': 'multipart/form-data' } })
}
export const exportCustomers = () => request.get('/customer/export', { responseType: 'blob' })
export const getMonthlyNewCustomers = () => request.get('/customer/monthly-new')